using System;
using System.Windows.Controls;
using Phoenix.Frames;
using Phoenix.Framework;
using Phoenix.Lifetime;

namespace Phoenix.Tests.Frames
{
    public static class ContentFrameControllerExtensions
    {
        public static ContentFrameController Navigate(this ContentFrameController controllerFrame, ViewModelBase toViewWithViewModel, 
            ControllerAction action = null, InvokeOptions options = InvokeOptions.None)
        {
            var view = new UserControl { DataContext = toViewWithViewModel };
            var controllerAction = action ?? new ControllerAction("", "", null);
            var requestTransientStore = new RequestTransientStore();
            controllerFrame.NavigateTo(new NavigationRequest(controllerAction, null, view, requestTransientStore, options));
            return controllerFrame;
        }
    }
}